home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / MISC / MAG08.ZIP / ROOMGEN.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-04-22  |  2.4 KB  |  87 lines

  1. Program RoomGen;
  2.  
  3. Uses Crt;
  4.  
  5. Type Room=Record
  6.                 Desc:Array[1..10] of String[79];
  7.                 North,South,East,West:Byte;
  8.           End;
  9.  
  10. Var F:Text;
  11.     Filename:String;
  12.     NumberRooms:Byte;
  13.  
  14.     A:Byte;
  15.     B:Byte;
  16.     R:Room;
  17.     Flag:Boolean;
  18.  
  19. Begin
  20.      Clrscr;
  21.      Textcolor(Yellow);
  22.      Write('««««««««««««««««««««««««««««««« Room Generator »»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»');
  23.      Writeln;
  24.      Textcolor(Magenta);
  25.      Writeln('                                By Spellcaster');
  26.      Writeln;
  27.      Textcolor(Cyan);
  28.      Writeln('Type in the name of the file on which the data of the rooms');
  29.      Writeln('will be write...');
  30.      Textcolor(Green);
  31.      Write('Name of the room-file > ');
  32.      Readln(Filename);
  33.      If Filename='' Then Exit;
  34.      Textcolor(Cyan);
  35.      Writeln('Type in the number of rooms that the game has...');
  36.      Textcolor(LightRed);
  37.      Write('Number of rooms > ');
  38.      Readln(NumberRooms);
  39.      If NumberRooms=0 Then Exit;
  40.      Assign(F,Filename);
  41.      ReWrite(F);
  42.      For A:=1 To NumberRooms Do
  43.      Begin
  44.           Writeln;
  45.           Textcolor(Cyan);
  46.           Writeln('Room ',A);
  47.           Writeln;
  48.           Textcolor(LightGreen);
  49.           For B:=1 To 10 Do R.Desc[B]:='';
  50.           Flag:=True;
  51.           B:=1;
  52.           While Flag Do
  53.           Begin
  54.                Writeln('Description Line ',B);
  55.                Readln(R.Desc[B]);
  56.                If (B=10) Or (R.Desc[B]='*') Then Flag:=False;
  57.                Inc(B);
  58.           End;
  59.           Textcolor(Cyan);
  60.           Writeln;
  61.           Writeln('Type in the exit''s numbers...');
  62.           Writeln;
  63.           Textcolor(LightGreen);
  64.           Write('North > '); Readln(R.North);
  65.           Write('South > '); Readln(R.South);
  66.           Write('East  > '); Readln(R.East);
  67.           Write('West  > '); Readln(R.West);
  68.           B:=1;
  69.           Flag:=True;
  70.           While Flag Do
  71.           Begin
  72.                Writeln(F,R.Desc[B]);
  73.                If (R.Desc[B]='*') Or (B=10) Then Flag:=False;
  74.                Inc(B);
  75.           End;
  76.           Writeln(F,R.North);
  77.           WritelN(F,R.South);
  78.           Writeln(F,R.East);
  79.           Writeln(F,R.West);
  80.      End;
  81.      Writeln;
  82.      Close(F);
  83.      Textcolor(Lightred);
  84.      Writeln('The room data is saved...');
  85.      Textcolor(LightGray);
  86.      Repeat Until Keypressed;
  87. End.